

cc.Class({
    extends: cc.Component,

    properties: {
    scoreboard:[cc.Label],
    designation:cc.Label,

    },

   

    onLoad () {
        
        this.scoreboard[1].string = "score:" + cc.myData.scorenum;
        this.scoreboard[2].string = "击中次数:" + cc.myData.hit_num;
        this.scoreboard[3].string = "脱靶次数:" + cc.myData.Miss_target;

        
        this.highscore = cc.sys.localStorage.getItem("hit_score") || 0;

        if(cc.myData.scorenum > Number(this.highscore)){
            
            cc.sys.localStorage.setItem("hit_score",cc.myData.scorenum);
            this.highscore = cc.myData.scorenum;

        }

        this.scoreboard[0].string = "highscore:" + this.highscore;
        

        if(cc.myData.scorenum == 0){
            this.designation.string = "没救了";
        }else if(cc.myData.scorenum > 0 && cc.myData.scorenum <= 20){
            this.designation.string = "斗者";
        }else if(cc.myData.scorenum > 20 && cc.myData.scorenum <= 40){
            this.designation.string = "斗王";
        }else if(cc.myData.scorenum > 40 && cc.myData.scorenum <= 60){
            this.designation.string = "斗圣";
        }else{
            this.designation.string = "斗尊";
        }
        cc.myData.scorenum = 0;
        cc.myData.hit_num = 0;
        cc.myData.Miss_target = 0;
    },

    startgame:function(){
     cc.director.loadScene("game");
    },

    start () {

    },

    update (dt) {},
});
